package control

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"time"
)

func RenderTemp(c *gin.Context){
	c.HTML(http.StatusOK, "index.html", gin.H{
		"name":"go-gin",
		"data":"模板渲染",
	})
}

func RenderUser(c *gin.Context){
	time.Sleep(3*time.Second)
	value, _ := c.Get("mid")
	//val := c.MustGet("midd")
	c.HTML(http.StatusOK, "user/user.html", gin.H{
		"title":"userHeader",
		"username":"go-gin",
		"password":"123456",
		"data":"多层结构",
		"mid":value,
		//"midd":val,
	})
}

func RenderHeader(c *gin.Context){
	c.HTML(http.StatusOK, "user/header.html", gin.H{
		"title":"user",
	})
}